//
//  XFHomeTitleView.swift
//  mxfweibo
//
//  Created by apple1 on 15/12/20.
//  Copyright © 2015年 莫祥富. All rights reserved.
//

import UIKit

class XFHomeTitleView: UIButton {

    //创建按钮
    init(imageName:String,title:String) {
        super.init(frame: CGRectZero)
        setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        setTitle(title, forState: UIControlState.Normal)
        setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        sizeToFit()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    //修改文字和图片的布局
    override func layoutSubviews() {
        super.layoutSubviews()
        self.titleLabel?.frame.origin.x = 0
        self.imageView?.frame.origin.x = self.titleLabel!.frame.width + 3
    }
 
}
